<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<view class="text-item"><text class="title">{{title}}</text></view>
			<view class="text-item"><u-button type="primary" @tap="login">登录</u-button></view>
			<view class="text-item"><u-button type="success" @tap="Phone">手机</u-button></view>
		</view>
		<getUserPhone 
			v-if="phone_show" 
			:phone_then="phone_then" 
			@toParent="phoneThen"
			@close="phone_show = false"
			></getUserPhone>
	</view>
</template>

<script>
	import common from '@/mixins/common.js'
	import pay from '@/mixins/pay.js'
	import wxLogin from '@/mixins/wxLogin.js'
	import getUserPhone from '@/components/getPhoneOauth.vue'
	export default {
		mixins:[common,pay,wxLogin],
		components:{getUserPhone},
		data() {
			return {
				title: '登录',
				phone_show:false,
				phone_then:'after_get_phone'
			}
		},
		onLoad() {
				
		},
		methods: {
			login(){
				let that = this
				this.wxLogin().then(e=>{
					console.log(e)
					that.showToast(e.msg);
				})
			},
			Phone(){
				this.phone_show = true
			},
			phoneThen(e){
				console.log(e)  // after_get_phone (this.phone_then)
				this.phone_show = false
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
		
		.text-item{
			text-align: center;
			margin: 30rpx auto;
		}
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
